#include<iostream>
#include<algorithm>
using namespace std;
const int N=3e4+10;
int w[N];
int main()
{
	int m,n;cin>>m>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>w[i];
	}
	sort(w+1,w+1+n);
	int l=1,r=n;
	int ret=0;
	while(l<=r)
	{
		if(w[l]+w[r]>m)  r--;
		else
		{
			r--;
			l++;
		}
		ret++;
	}
	cout<<ret<<endl;
}